
#ifndef __RTC_H__
#define __RTC_H__

#include "driverh.h"

void RtcInit(void);
void RtcSetTime(INT32U time);
void RtcSetTimeLocal(INT32U time);
INT32U RtcGetTime(void);
INT32U RtcGetRunTime(void);


INT32U RtcDateTimeToSecond(DateTimeType dt);
DateTimeType RtcSecondToDataTime(INT32U second);

INT32S RtcDiffSysSecond(INT32U second);
INT32S RtcDateTimeCmp(DateTimeType *pdatetime1, DateTimeType *pdatetime2);

BOOL RtcIsDateTimeValid(DateTimeType *pDateTime);
BOOL RtcIsDateTimeValidB(INT32U s);

void RtcGetDateTime(DateTimeType *pDateTime);
void RtcAddSecond(INT8U arg);
void RtcGetDateByDays(DateTimeType *pDateTime, INT32U days);
void RtcDateTimeAddMin(DateTimeType *pdatetime, INT16U min);
void RtcDateTimeDecDay(DateTimeType *pdatetime);
void RtcDateTimeDecHour(DateTimeType *pdatetime);
void RtcDateTimeAddMonth(DateTimeType *pDateTime, INT8U month);
void CalibrateTimeBy8025(void);
void RtcGetDateTimeByHours(DateTimeType *pdatetime, INT32U hours);
void RtcGetDateTimeByMinutes(DateTimeType *pdatetime, INT32U minutes);

INT8U RtcCalWeek(DateTimeType Dt);
INT8U RtcGetMaxDay(INT16U year, INT8U month);
INT16U RtcGetDaysByDate(INT16U year, INT8U month, INT8U day);
INT32U RtcGetHoursByDateTime(DateTimeType *pdatetime);
INT32U RtcGetMinutesByDateTime(DateTimeType *pdatetime);

#endif
